
const dateUtils = {
    /**
     * 功能：工具类，获取当前日期
     * @returns 输出：当前日期(String yyyy-MM-dd)
     */
    getCurrentDayStr(){
        var date = new Date()
        var year = date.getFullYear()
        var month = date.getMonth() + 1
        var day = date.getDate()
        if (month < 10) {
            month = "0" + month
        }
        if (day < 10) {
            day = "0" + day
        }
        var nowDate = year + "-" + month + "-" + day
        return nowDate
    },
    
    /**
     * 功能：工具类，获取日期之间的差值
     * @param {*} before 开始日期(Date)
     * @param {*} after 结束日期(Date)
     * @returns 输出：日期之间的天数差值(数值)
     */
    getDiffDays(before,after){
        let timeDiff = after.getTime() - before.getTime()
        let daysDiff = Math.ceil(timeDiff/(1000 * 60 * 60 * 24))
        return daysDiff
    }

}
export default dateUtils